// Ionic Starter App
var BASEURL="http://i4.ghkchina.com/"
// angular.module is a global place for creating, registering and retrieving Angular modules
// 'starter' is the name of this angular module example (also set in a <body> attribute in index.html)
// the 2nd parameter is an array of 'requires'
// 'starter.services' is found in services.js
// 'starter.controllers' is found in controllers.js
angular.module('zc', ['ionic', 'starter.controllers', 'starter.services'])

.run(function($ionicPlatform) {
  $ionicPlatform.ready(function() {
    // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
    // for form inputs)
    if (window.cordova && window.cordova.plugins && window.cordova.plugins.Keyboard) {
      cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
      cordova.plugins.Keyboard.disableScroll(true);

    }
    if (window.StatusBar) {
      // org.apache.cordova.statusbar required
      StatusBar.styleDefault();
    }
  });
})

.config(function($stateProvider, $urlRouterProvider) {
      $urlRouterProvider.otherwise('/tab/index');
  // Ionic uses AngularUI Router which uses the concept of states
  // Learn more here: https://github.com/angular-ui/ui-router
  // Set up the various states which the app can be in.
  // Each state's controller can be found in controllers.js
  $stateProvider
//链接路由设置
  // setup an abstract state for the tabs directive
    .state('tab', {
    url: '/tab',
    abstract: true,
    templateUrl: 'templates/tabs.html'
  })

  // Each tab has its own nav history stack:
//tab-首页
  .state('tab.index', {
    url: '/index',
    views: {
      'tab-index': {
        templateUrl: 'templates/tab-index.html',
        controller: 'DashCtrl'
      }
    }
  })
    //tab-首页-登录
      .state('tab.index-login', {
        url: '/index/login',
        views: {
          'tab-index': {
            templateUrl: 'templates/index-login.html',
            controller: 'DashCtrl'
          }
        }
      })
    //tab-首页-注册
    .state('tab.index-register', {
      url: '/index/register',
      views: {
        'tab-index': {
          templateUrl: 'templates/index-register.html',
          controller: 'DashCtrl'
        }
      }
    })
    //tab-首页-注册-实名认证
      .state('tab.register-sm', {
        url: '/index/register/sm',
        views: {
          'tab-index': {
            templateUrl: 'templates/register-sm.html',
            controller: 'DashCtrl'
          }
        }
      })
    //tab-首页-安全保障
    .state('tab.index-security', {
      url: '/index/security',
      views: {
        'tab-index': {
          templateUrl: 'templates/more-security.html',
          controller: 'DashCtrl'
        }
      }
    })
    //tab-首页-关于我们
    .state('tab.index-about', {
      url: '/index/about',
      views: {
        'tab-index': {
          templateUrl: 'templates/more-about.html',
          controller: 'DashCtrl'
        }
      }
    })
    //tab-首页-新手指引
    .state('tab.index-novice', {
      url: '/index/novice',
      views: {
        'tab-index': {
          templateUrl: 'templates/index-novice.html',
          controller: 'DashCtrl'
        }
      }
    })
    //tab-首页-帮助中心
    .state('tab.index-help', {
      url: '/index/help',
      views: {
        'tab-index': {
          templateUrl: 'templates/more-help.html',
          controller: 'DashCtrl'
        }
      }
    })
    //tab-投资列表
  .state('tab.touzilist', {
      url: '/touzilist',
      views: {
        'tab-touzilist': {
          templateUrl: 'templates/tab-touzilist.html',
          controller: 'listCtrl'
        }
      }
    })
//tab-投资列表-投资详情
    .state('tab.information', {
      url: '/touzilist/information',
      views: {
        'tab-touzilist': {
          templateUrl: 'templates/touzilist-information.html',
          controller: 'listCtrl'
        }
      }
    })

    //tab-投资列表-投资详情-确认投标
      .state('tab.qr', {
        url: '/touzilist/information/qr',
        views: {
          'tab-touzilist': {
            templateUrl: 'templates/information-qr.html',
            controller: 'listCtrl'
          }
        }
      })
    //tab-我
      .state('tab.my', {
        url: '/my',
        views: {
          'tab-my': {
            templateUrl: 'templates/tab-my.html',
            controller: 'myCtrl'
          }
        }
      })
    //tab-我-我的投资
      .state('tab.my-touzi', {
        url: '/my/touzi',
        views: {
          'tab-my': {
            templateUrl: 'templates/my-touzi.html',
            controller: 'myCtrl'
          }
        }
      })
    //tab-我-我的账单
      .state('tab.my-zhangdan', {
        url: '/my/zhangdan',
        views: {
          'tab-my': {
            templateUrl: 'templates/my-zhangdan.html',
            controller: 'myCtrl'
          }
        }
      })
    //tab-我-我的现金券
      .state('tab.my-xjq', {
        url: '/my/xjq',
        views: {
          'tab-my': {
            templateUrl: 'templates/my-xjq.html',
            controller: 'myCtrl'
          }
        }
      })
    //tab-我-提现申请
      .state('tab.my-tixian', {
        url: '/my/tixian',
        views: {
          'tab-my': {
            templateUrl: 'templates/my-tixian.html',
            controller: 'myCtrl'
          }
        }
      })
    //tab-我-在线充值
    .state('tab.my-chongzhi', {
      url: '/my/chongzhi',
      views: {
        'tab-my': {
          templateUrl: 'templates/my-chongzhi.html',
          controller: 'myCtrl'
        }
      }
    })
//tab-我-银行卡设置
    .state('tab.my-bankcardset', {
      url: '/my/bankcardset',
      views: {
        'tab-my': {
          templateUrl: 'templates/my-bankcardset.html',
          controller: 'myCtrl'
        }
      }
    })
    //tab-我-银行卡设置-银行卡信息
      .state('tab.bankcard-xinxi', {
        url: '/my/bankcardset/xinxi',
        views: {
          'tab-my': {
            templateUrl: 'templates/bankcard-xinxi.html',
            controller: 'myCtrl'
          }
        }
      })

    //tab-我-银行卡设置-添加银行卡
      .state('tab.add', {
        url: '/my/bankcardset/add',
        views: {
          'tab-my': {
            templateUrl: 'templates/bankcard-add.html',
            controller: 'myCtrl'
          }
        }
      })
    //tab-我-修改用户密码
    .state('tab.my-updatepsd', {
      url: '/my/updatepsd',
      views: {
        'tab-my': {
          templateUrl: 'templates/my-updatepsd.html',
          controller: 'myCtrl'
        }
      }
    })
    //tab-我-自动投标设置
      .state('tab.my-zidong', {
        url: '/my/zidong',
        views: {
          'tab-my': {
            templateUrl: 'templates/my-zidong.html',
            controller: 'myCtrl'
          }
        }
      })
    //tab-我-更多
      .state('tab.my-more', {
          url: '/my/more',
          views: {
              'tab-my': {
                  templateUrl: 'templates/my-more.html',
                  controller: 'myCtrl'
              }
          }
      })
    //tab-我-更多-帮助中心
    .state('tab.more-help', {
      url: '/my/more/help',
      views: {
        'tab-my': {
          templateUrl: 'templates/more-help.html',
          controller: 'myCtrl'
        }
      }
    })
    //tab-我-更多-安全保障
    .state('tab.more-security', {
      url: '/my/more/security',
      views: {
        'tab-my': {
          templateUrl: 'templates/more-security.html',
          controller: 'myCtrl'
        }
      }
    })
    //tab-我-更多-关于我们
    .state('tab.more-about', {
      url: '/my/more/about',
      views: {
        'tab-my': {
          templateUrl: 'templates/more-about.html',
          controller: 'myCtrl'
        }
      }
    })
    //.state('tab.chat-detail', {
    //  url: '/chats/:chatId',
    //  views: {
    //    'tab-chats': {
    //      templateUrl: 'templates/chat-detail.html',
    //      controller: 'ChatDetailCtrl'
    //    }
    //  }
    //})
//tab-积分商城
      .state('tab.jifen', {
        url: '/jifen',
        views: {
          'tab-jifen': {
            templateUrl: 'templates/tab-jifen.html',
            controller: 'jifenCtrl'
          }
        }
      })
    //tab-积分商城
      .state('tab.jifen-duihuan', {
        url: '/jifen/duihuan',
        views: {
          'tab-jifen': {
            templateUrl: 'templates/jifen-duihuan.html',
            controller: 'jifenCtrl'
          }
        }
      });

  // if none of the above states are matched, use this as the fallback
  $urlRouterProvider.otherwise('/tab/index');

});
